Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix saturating overflows (SlowMist N1) #136

Merged
merged 3 commits into from
Nov 13, 2023
Merged

Conversation

clostao
Copy link
Contributor

@clostao clostao commented Nov 6, 2023

Description

Slowmist problem description:

The use of saturating_add , saturating_mul , and saturating_sub in Rust is generally intended to prevent
integer overflow and underflow, ensuring that the result remains within the valid range for the data type. However, in
certain cases, relying on these functions alone can lead to inaccurate or unexpected results. This occurs when the
application logic assumes that saturation alone guarantees accurate results, but ignores the potential loss of
precision or accuracy..

Our response:

We assumed that we were losing precision though is better to throw an error in such case. Suggested changes have been applied.

Types of changes

What types of changes does your code introduce?

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

@clostao clostao force-pushed the fix-saturing-overflows branch from 829e52b to cf65581 Compare November 6, 2023 16:01
@GabrielMartinezRodriguez
Copy link
Contributor

LGTM!

chain-specs/testnet.json Outdated Show resolved Hide resolved
@clostao clostao merged commit a31b427 into main Nov 13, 2023
1 check passed
@clostao clostao deleted the fix-saturing-overflows branch November 13, 2023 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants